from core.basehandler import BaseHandler
from core.room import Room
from core.question import Question
from core.action import Action

class thirdFloorArena(Room):
    def __init__(self, room_id ):
        Room.__init__(self, room_id)
        
        #self.add_action(Fight)
        self.add_action(Win)
        
        self.questions = {}
        self.succeed = True
        
        q1 = Question("q1","Who wrote the world's best book, Game of Thrones?")
        q1.add_choice("1", "Martin P. George")
        q1.add_choice("2", "George R. R. Harris")
        q1.add_choice("3", "George R. R. Martin")
        q1.add_choice("4", "Martin R. S. Peters")
        q1.set_answer("3")
        
        q2 = Question("q2","What is one of the animals represented in any of the family crests?")
        q2.add_choice("1", "Piglet")
        q2.add_choice("2", "Dragon")
        q2.add_choice("3", "Tiger")
        q2.add_choice("4", "Snake")
        q2.set_answer("2")
        
          
        self.questions[q1.get_id()]=q1
        self.questions[q2.get_id()]=q2
#                
    def get_description(self):
        return "You must answer the following question correctly"
    
    def get_image(self):
        return 'lubin.jpg'
    
    
        
        
class thirdFloorArenaHandler(BaseHandler):
    
    # return class to use to create a new instance of this room
    def get_room_class(self):
        return thirdFloorArena
    
    def get_template(self):
        return 'challenge.html'



class Fight(Action):
    def __init__(self):
        Action.__init__(self, "Fight")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Challenge professor Lubin!"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'thirdFloorTreasure'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"


class Win(Action):
    def __init__(self):
        Action.__init__(self, "Win")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Win"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'thirdFloorTreasure'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"




    